perm filename NEAR[ALS,ALS] blob sn#328466 filedate 1978-01-18 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	NEAR	LISU	PLOC		Look to active pieces
C00005 ENDMK
CāŠ—;
NEAR	LISU	PLOC		Look to active pieces
	LISL	0
	LIS	H'4'
	LR	1,A		To count bytes
	CLR
	LR	2,A		To accumulate score
NE2	CLR
	AS	I
	BNZ	NE3		Something in this byte
	DS	1
	BNZ	NE2		To the next byte
	BR	NE2A
NE2B	DCI	ISAV
	LM
	LR	IS,A
	LR	A,I
NE3	LR	3,A		Save the byte
	LR	A,IS
	DCI	ISAV		To save ISAR
	ST
	LR	A,3
	AI	H'2'		(one index already)
	LR	IS,A		Get aft passive byte location
	CI	O`33'
	BP	NE4		Too far aft
	LR	A,I		Get passive byte
	NS	3		Test for opposition
	BZ	NE4		no opposing bits
NE3A	DS	2		Add to score
	LR	4,A
	AI	H'FF'
	NS	4		Remove 1 bit
	BNZ	NE3A		Are any bits left?
NE4	LR	A,I		Now get abeam passive
	LR	5,A		Save it
	SR	4		shifted to match
	SR	1		and 1 more
	NI	H'77'		Prevent row to row overfllow
	NS	3		An abeam opposition?
	BZ	NE5		No
NE4A	DS	2		Yes
	LR	4,A
	AI	H'FF'
	NS	4		Remove 1 bit
	BNZ	NE4A		Are any bits left?
NE5	LR	A,5
	SR	4
	SL	1		Now the other direction
	NI	H'EE'		Prevent row to row overflow
	NS	3		An abeam opposition?
	BZ	NE8		No
NE5A	DS	2		Yes
 	LR	4,A
	AI	H'FF'
	NS	4		Remove 1 bit
	BNZ	NE5A		Are any bits left?
NE8	LR	A,IS		Is fore byte available?
	CI	H'30'		Are we still in range?
	BZ	NE10		No, too far
	LR	A,S		Now the fore passive
	NS	3		An opposition?
	BZ	NE9		No
NE8A	DS	2		Add to score
	LR	4,A
	AI	H'FF'
	NS	4		Remove 1 bit
	BNZ	NE8A		Are any bits left?
	DS	1
	BNZ	NE2B
NE2A	LR	A,2
	COM
	INC			Convert score to + number
	AS	MAT
	LR	MAT,A